-
Notifications
You must be signed in to change notification settings - Fork 12
ChildProcess: account for a system error when launching a process #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChildProcess: account for a system error when launching a process #66
Conversation
f68dff5 to
f0f0f73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 👍
|
Thanks! CI fails seems unrelated, perhaps |
f0f0f73 to
d8e18be
Compare
|
Managed to build it locally, and yes, in I fixed it in a separate commit, please tell if you want it to be sent in a separate PR. |
d8e18be to
54c8016
Compare
54c8016 to
a95fb6e
Compare
|
Ah yeah, |
src/Node/ChildProcess.purs
Outdated
| _, _ -> if isJust $ toMaybe r.error | ||
| then BySysError | ||
| else unsafeCrashWith $ "Impossible: `spawnSync` child process neither exited nor was killed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| _, _ -> if isJust $ toMaybe r.error | |
| then BySysError | |
| else unsafeCrashWith $ "Impossible: `spawnSync` child process neither exited nor was killed." | |
| _, _ -> | |
| if isJust (toMaybe r.error) then | |
| BySysError | |
| else | |
| unsafeCrashWith "Impossible: `spawnSync` child process neither exited nor was killed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or option 2:
| _, _ -> if isJust $ toMaybe r.error | |
| then BySysError | |
| else unsafeCrashWith $ "Impossible: `spawnSync` child process neither exited nor was killed." | |
| _, _ | |
| | isJust (toMaybe r.error) -> BySysError | |
| | otherwise -> unsafeCrashWith "Impossible: `spawnSync` child process neither exited nor was killed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I like this one! Let me try this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, didn't see this message until now 😄 I think either way is fine though stylistically, and they should compile to pretty much the same JS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's okay and thank you!
When a non-existing command is attempted to run, both status and signal will be null, which leads to ChildProcess module crashing. Obviously, this is incorrect behavior. The problem is more general than that though: any system error that would result in failing to run a process would result in the module crash. Fix that by checking for such case. Fixes: purescript-node#65
a95fb6e to
60eec01
Compare
|
Thank you, done! |
|
Thanks! |
|
Now released as v12.0.0 - even though this was a bug fix, the introduction of |

Description of the change
When a non-existing command is attempted to run, both status and signal will be null, which leads to ChildProcess module crashing. Obviously, this is incorrect behavior.
The problem is more general than that though: any system error that would result in failing to run a process would result in the module crash.
Fix that by checking for such case.
Fixes: #65
Checklist: